<?php
declare (strict_types = 1);

namespace app\common\model;

use think\Model;
use think\model\concern\SoftDelete;
class SchoolWorkerTask extends Model
{
    use SoftDelete;
     protected $deleteTime = false;
    // 获取列表
    public static function getList()
    {

        $limit = input('get.limit');
        $admin = session('admin');
        $worker = AdminAdmin::where('top_id', $admin['id'])->paginate($limit);
        $list = $worker->items();
        foreach ($list as $k => $v) {
            $list[$k]['task'] = self::order('id','desc')
                ->where(['admin_id' => $v['id']])
                ->where('month', toDate(time(), 'Y-m'))
                ->find();
        }
        return ['code'=>0,'data'=>$list,'extend'=>['count' => $worker->total(), 'limit' => $limit]];
    }
}
